package com.langyiquan.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value = "UnifyResponse")
public class UnifyResponse {

    @ApiModelProperty(name = "code",value = "返回code,200正常，其他则为异常",required = true)
    private Integer code;

    @ApiModelProperty(name = "message",value = "相应信息",required = true)
    private String message;

    @ApiModelProperty(name = "data",value = "响应数据",required = true)
    private Object data;

    public UnifyResponse(Object data) {
        this.code = 200;
        this.message = "OK";
        this.data = data;
    }

    public static UnifyResponse success(Object data) {
        return new UnifyResponse(data);
    }

    public static UnifyResponse success() {
        return new UnifyResponse(null);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
